/**
 * Title: PhoneNumberManager.java
 * Description:
 * Copyright: Copyright (c) 2008
 * Company:深圳彩讯科技有限公司
 * Author 罗旭东 (hi@luoxudong.com)
 * Date 2014-1-14 下午4:39:25
 * Version 1.0
 */
package com.luoxudong.phonenumber.logic.number.manager;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;

import com.luoxudong.phonenumber.logic.http.model.request.GetProductDetailReq;
import com.luoxudong.phonenumber.logic.http.model.response.GetProductDetailRsp;
import com.luoxudong.phonenumber.logic.number.interfaces.IGetProductDetailListener;
import com.luoxudong.phonenumber.logic.number.interfaces.IPhoneNumbserManager;
import com.luoxudong.phonenumber.service.net.http.asynchttp.AsyncHttpUtil;
import com.luoxudong.phonenumber.service.net.http.asynchttp.interfaces.ISimpleJsonRequestListener;
import com.luoxudong.phonenumber.service.net.http.utils.HttpApiUtil;

/** 
 * ClassName: PhoneNumberManager
 * Description:TODO(这里用一句话描述这个类的作用)
 * Create by 罗旭东
 * Date 2014-1-14 下午4:39:25
 */
public class PhoneNumberManager implements IPhoneNumbserManager{
	@Override
	public void getProductDetailFromService(Context context, String phoneNumber, final IGetProductDetailListener listener) {
		GetProductDetailReq req = new GetProductDetailReq();
		req.setPhoneNumber(phoneNumber);
		AsyncHttpUtil.simpleJsonRequest(HttpApiUtil.getFullUrl(context, HttpApiUtil.URL_SERVICE_GET_PRODUCT_DETAIL), req, GetProductDetailRsp.class, new ISimpleJsonRequestListener<GetProductDetailRsp>() {

			@Override
			public void onFailed(int errorCode, String errorMsg) {
				if (listener != null)
				{
					listener.onCallbackFail(errorCode, errorMsg);
				}
			}

			@Override
			public void onStart() {
				
			}

			@Override
			public void onSuccess(GetProductDetailRsp responseInfo) {
				if (listener != null)
				{
					listener.onCallbackSuc(responseInfo);
				}
			}

		});
		
		//Map<String, String> urlParams = new HashMap<String, String>();
		//urlParams.put("q", "18819000823");
		//AsyncHttpUtil.simpleHttpFormRequest("http://mobile.9om.com/", urlParams, null);
	}

}
